#include "headers.h"

void drawLamps (void) {
  GLUquadricObj *p = gluNewQuadric();
  float mat_emission[] = {0.8f, 0.8f, 0.0f, 0.0f};
  float no_emission[] = {0.0f, 0.0f, 0.0f, 1.0f};

  // GL_LIGHT0
  glPushMatrix();
  if (glIsEnabled(GL_LIGHT0)){
    glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission);
    glColor3f(1., 1., 0.);
  }
  else {
    glColor3f(.5, .5, .5);
  }
  glTranslatef(0.0, 595.0 , 0.0);
  glutSolidSphere(5.0, 100, 100);
  glMaterialfv(GL_FRONT, GL_EMISSION, no_emission);
  glPopMatrix();
  

  // GL_LIGHT1
  glPushMatrix ();
  glColor3f(0.8f, 0.8f, 0.8f);
  glTranslatef(-60.0, 175 -2, 0.0);
  glRotatef(-90.0, 1.0, 0.0, 0.0);
  gluCylinder(p, 1, 1, 430, 5, 5);
  glPopMatrix();
  
  glPushMatrix ();
  glColor3f(0.8f, 0.8f, 0.8f);
  glTranslatef(-60.0, 175 -2, 0.0);
  glRotatef(-90.0, 1.0, 0.0, 0.0);
  gluCylinder(p, 15, 1, 15, 5, 5);
  glPopMatrix();
  
  glPushMatrix();
  if (glIsEnabled(GL_LIGHT1)){
    glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission);
    glColor3f(1., 1., 0.);
  }
  else {
    glColor3f(.5, .5, .5);
  }
  glTranslatef(-60.0, 175 , 0);
  glutSolidSphere(5.0, 100, 100);
  glMaterialfv(GL_FRONT, GL_EMISSION, no_emission);
  glPopMatrix();

  // GL_LIGHT2
  glPushMatrix ();
  glColor3f(0.8f, 0.8f, 0.8f);
  glTranslatef(60.0, 175 -2, 0.0);
  glRotatef(-90.0, 1.0, 0.0, 0.0);
  gluCylinder(p, 1, 1, 430, 5, 5);
  glPopMatrix();
  
  glPushMatrix ();
  glColor3f(0.8f, 0.8f, 0.8f);
  glTranslatef(60.0, 175 -2, 0.0);
  glRotatef(-90.0, 1.0, 0.0, 0.0);
  gluCylinder(p, 15, 1, 15, 5, 5);
  glPopMatrix();

  glPushMatrix();
  if (glIsEnabled(GL_LIGHT2)){
    glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission);
    glColor3f(1., 1., 0.);
  }
  else {
    glColor3f(.5, .5, .5);
  }
  glTranslatef(60.0, 175 , 0);
  glutSolidSphere(5.0, 100, 100);
  glMaterialfv(GL_FRONT, GL_EMISSION, no_emission);
  glPopMatrix();
}
